var ToolTip = {
    ele_container: null,
    ele_container_i: null,
    ele_waiter: null,
    ele_iframe: null,
    ele_closebtn: null,
    
    init: function() {
	tt_div = document.createElement('div');
	tt_div.setAttribute('id', 'tooltip_container');
	tt_div.setAttribute('class', 'ToolTipContainer');
	document.getElementsByTagName('body')[0].appendChild(tt_div);
	
	tt_i_div = document.createElement('div');
	tt_i_div.setAttribute('id', 'tooltip_container_i');
	tt_i_div.setAttribute('class', 'ToolTipContainer_internal');
	tt_div.appendChild(tt_i_div);
	
	waiter = document.createElement('img');
	waiter.setAttribute('src', '/img/spin.gif');
	waiter.setAttribute('id', 'tooltip_spinner');
	waiter.setAttribute('style', 'width: 32px; height: 32px;');
	tt_i_div.appendChild(waiter);
	
	frame = document.createElement('iframe');
	frame.setAttribute('id', 'tooltip_iframe');
	frame.setAttribute('class', 'ToolTipiframe');
	tt_i_div.appendChild(frame);
	
	/* 
	 * IE Hates the button creation! just inject it?
	 */
	tt_i_div.innerHTML += '<br /><button type="button" onclick="ToolTip.hideDisplay()" id="tooltip_close_btn">[X - Close]</button>';
	ToolTip.reset();
    },
    
    display: function(uri) {
	ToolTip.reset();
	document.getElementById('tooltip_container').style.display = "block";
	document.getElementById('tooltip_container').style.visibility = "visible";
	document.getElementById('tooltip_container_i').style.display = "block";
	document.getElementById('tooltip_container_i').style.visibility = "visible";
	frame = document.getElementById('tooltip_iframe');
	frame.src = uri;
	frame.onload = ToolTip.if_onLoad();
	setTimeout('ToolTip.noload()', 3000);
    },
    
    hideDisplay: function() {
	ToolTip.reset();
	document.getElementById('tooltip_container').style.display = "none";
	document.getElementById('tooltip_container').style.visibility = "hidden";
	frame.src = "";
    },
    
    hide: function() {
	ToolTip.reset();
    },
    
    show: function() {
	document.getElementById('tooltip_spinner').style.display = "none";
	document.getElementById('tooltip_spinner').style.visibility = "hidden";
	//document.getElementById('tooltip_iframe').style.display = "block";
	document.getElementById('tooltip_iframe').style.visibility = "visible";
	document.getElementById('tooltip_iframe').style.display = "inline";
	document.getElementById('tooltip_close_btn').style.visibility = "visible";
    },
    
    reset: function() {
	document.getElementById('tooltip_close_btn').style.display = "inline";
	document.getElementById('tooltip_spinner').style.visibility = "visible";
	document.getElementById('tooltip_spinner').style.display = "inline";
	//document.getElementById('tooltip_iframe').style.display = "none";
	document.getElementById('tooltip_iframe').style.visibility = "hidden";
	document.getElementById('tooltip_iframe').style.display = "none";
	document.getElementById('tooltip_close_btn').style.visibility = "hidden";
    },
    
    /*
     * If 3 seconds passed, give them a close button.
     */
    noload: function() {
	document.getElementById('tooltip_close_btn').style.display = "inline";
    },
    
    if_onLoad: function() {
	ToolTip.show();
    }
};

setTimeout('ToolTip.init()', 750);